package file;

import java.util.prefs.Preferences;

/**
 * 使用Preference 存储数据
 */
public class PreferencesDemo {
    public static void main(String[] args) {
        Preferences preferences = Preferences.userNodeForPackage(PreferencesDemo.class);
        preferences.put("test", "Hello, World!!.");
    }
}

class PreferencesReadDemo {
    public static void main(String[] args) {
        Preferences preferences = Preferences.userNodeForPackage(PreferencesDemo.class);
        System.out.println(preferences.get("test", null));
    }
}
